package com.itmuch.youran.util;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import com.itmuch.core.constant.ConstantCommon;

public class PasswordEncoderUtil {
    public static BCryptPasswordEncoder getEncoder() {
        return new BCryptPasswordEncoder(ConstantCommon.BCRYPT_PASSWORD_STRENGTH);
    }

    public static String encode(String rawPassword) {
        return PasswordEncoderUtil.getEncoder().encode(rawPassword);
    }

    public static boolean matches(String rawPassword, String encodedPassword) {
        return getEncoder().matches(rawPassword, encodedPassword);
    }
    
    
//    public static void main(String[] args) {
//		System.out.println(PasswordEncoderUtil.encode("123456"));
//	}
}
